package com.yc.springclouduser.web;

import com.yc.springclouduser.clients.UserClients;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@RequestMapping("/index")
public class IndexAction {

//    @RequestMapping("index")
//    public String index(HttpServletRequest request){
//        int port = request.getServerPort();
//        return "index";
//    }
    @Autowired
    RestTemplate restTemplate;

    @Autowired
    UserClients userClients;



//    @RequestMapping("order")
//    public String order(){
//        return  restTemplate.getForObject(
//                "http://spring-cloud-order/order",
//                String.class
//        );
//    }

    @RequestMapping("user")
    public String order(){
        return  userClients.findById();
    }

    @RequestMapping("order")
    public String user(){
        return restTemplate.getForObject(
                "http://spring-cloud-user/user",
                String.class
        );
    }

    
}
